package ApplicationTest.Example.KafKa.Consumer

import org.apache.commons.pool2.impl.GenericObjectPoolConfig
import redis.clients.jedis.JedisPool

object RedisClient {
  val redisHost = "master"
  val redisPort = 6379
  val redisTimeOut = 30000
  //获取jedis 连接池
  lazy val pool = new JedisPool(new GenericObjectPoolConfig(), redisHost, redisPort, redisTimeOut)
  private lazy val hook = new Thread {
    override def run(): Unit = {
      println("Execute hook thread: " + this)
      pool.destroy()
    }
  }
  sys.addShutdownHook(hook.start()) //当jvm 准备结束的时候，调用钩子
}
